{template "header.html"}
<style> body{ overflow: hidden !important} </style>
<div style="text-align: center">

    <link href="{ROOT_THEME_PATH}assets/global/plugins/jquery-fileupload/css/jquery.fileupload.css" rel="stylesheet" type="text/css" />
    <script src="{ROOT_THEME_PATH}assets/global/plugins/jquery-fileupload/js/jquery.fileupload.js" type="text/javascript"></script>
    <div class="dev" id="fileupload">
        <a href="javaScript:;" class="fileinput-button btn read"> <i class="fa fa-upload"></i> {dr_lang('上传zip文件')}<input type="file" name="file_data"> </a>
        <div class="col-lg-12 fileupload-progress fade" style="display:none">
            <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                <div class="progress-bar progress-bar-success" style="width:0%;"> </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function() {
            $("#fileupload").fileupload({
                disableImageResize: false,
                autoUpload: true,
                maxFileSize: "10000000000",
                url: "{$upload_url}",
                dataType: "json",
                formData: { {csrf_token()}: "{csrf_hash()}" },
                acceptFileTypes: "*",
                maxChunkSize: 0,
                progressall: function (e, data) {
                // 上传进度条 all
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $("#fileupload .fileupload-progress").show();
                $("#fileupload .fileupload-progress").removeClass("fade");
                $("#fileupload .progress-bar-success").attr("style", "width: "+progress+"%");
            },
            add: function (e, data) {
                $("#fileupload .fileupload-progress").hide();
                data.submit();
            },
            done: function (e, data) {

                $("#fileupload .fileupload-progress").addClass("fade");
                $("#fileupload .fileupload-progress").hide();

                if (data.result.code > 0) {
                    dr_tips(1, '{dr_lang('上传成功，正在分析文件')}');
                    window.location.href = '{$add_url}';
                } else {
                    dr_tips(data.result.code, data.result.msg, -1);
                }
            },
            fail: function (e, data) {
                //console.log(data.errorThrown);
                dr_tips(0, "系统故障："+data.errorThrown, -1);
                layer.closeAll('tips');

            },
        });
        });
    </script>

</div>

{template "footer.html"}